namespace OasisCiq.XS
{
    using System;
    using System.Linq;

    /// <summary>
    /// A string that does not contain line feeds, carriage returns, or tabs.
    /// </summary>
    public class XSNormalizedString : XSString
    {
        public XSNormalizedString(string value)
            : base(value)
        {
            if ("\r\n\t".Any(value.Contains))
            {
                throw new ArgumentException();
            }
        }

        public static implicit operator XSNormalizedString(string argument)
        {
            return new XSNormalizedString(argument);
        }

        public static implicit operator string(XSNormalizedString argument)
        {
            return argument.Value;
        }
    }
}